home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magnum One
/
Magnum One (Mid-American Digital) (Disc Manufacturing).iso
/
d18
/
turbotut.arc
/
ARRAYS2.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1989-06-30
|
1KB
|
44 lines
PROGRAM multiple_arrays;
VAR index,count : INTEGER;
checkerboard : ARRAY[1..8] OF ARRAY[1..8] OF INTEGER;
value : ARRAY[1..8,1..8] OF INTEGER;
BEGIN (* Main program *)
FOR index := 1 TO 8 DO
BEGIN (* index loop *)
FOR count := 1 TO 8 DO
BEGIN
checkerboard[index,count] := index + 3*count;
value[index,count] := index + 2*checkerboard[index,count];
END;
END; (* of index loop *)
WRITELN(' Output of checkerboard');
WRITELN;
FOR index := 1 TO 8 DO
BEGIN
FOR count := 1 TO 8 DO
WRITE(checkerboard[index,count]:7);
WRITELN;
END;
value[3,5] := -1; (* change some of the value matrix *)
value[3,6] := 3;
value[value[3,6],7] := 2; (* This is the same as writing
value[3,7] := 2; *)
FOR count := 1 to 3 DO WRITELN; (* Three blank lines *)
WRITELN('Output of value');
WRITELN;
FOR count := 1 TO 8 DO
BEGIN
FOR index := 1 TO 8 DO
WRITE(value[count,index]:7);
WRITELN;
END;
END. (* of main program *)